<? defined('_JEXEC') or die; ?>
<? @style(@mediaurl.'/com_bib/css/bib.css'); ?>

<table width="100%">
	<tr>
		<td width="50%" >
		<form action="index.php" method="get">
		<fieldset><legend>Filter</legend>
		<table  >
			<tr>
				<td><label for="search"><?= @text( 'Filter by Search' ); ?>:</label>
				<input id="search" name="search" value="<?= @$state->search; ?>" />
				</td>
				<td><label for="search"><?= @text( 'Filter by genre' ); ?>:</label>
				<?= @helper('admin::com.bib.helper.select.genres', @$state->bib_genre_id) ?>
				</td>
				<td><label for="search"><?= @text( 'Filter by author' ); ?>:</label>
				<?= @helper('admin::com.bib.helper.select.authors', @$state->bib_author_id) ?>
				</td>
				<td>
				<button style="font-size:1.5em" onclick="this.form.submit();"><?php echo @text( 'Go' ); ?></button>
				</td>
			</tr>

		</table>
		<input type="hidden" name="option" value="com_bib" /> 
		<input type="hidden" name="view" value="books" />
		</fieldset>
		</form>
		</td>
		<td width="50%">
		<fieldset><legend><?= @text('Select by first letter')?></legend>
		<p><b><a
			href="<?= @route('index.php?option=com_bib&view=books&firstletter='); ?>">
			<?= @text('Reset'); ?> </a> |
			<? foreach (@$letters as $alfa) : ?> <a
			href="<?= @route('index.php?option=com_bib&view=books&firstletter='.$alfa->bib_bookletter_id); ?>">
			<?= $alfa->bib_bookletter_id; ?> </a> | <? endforeach; ?>
			</b></p>
			</fieldset>
		</td>
	</tr>
</table>


<br />

<form action="<?= @route('index.php?option=com_bib&view=books')?>"
	method="post" name="adminForm">

<table class="adminlist">
	<thead>
		<tr>
			<th width="5"><?= @text('NUM'); ?></th>
			<th width="20"><input type="checkbox" name="toggle" value=""
				onclick="checkAll(<?= count(@$books); ?>);" /></th>
			<th><?= @helper('grid.sort', 'Title', 'title', @$state->direction, @$state->order); ?>
			</th>
			<th><?= @helper('grid.sort', 'Author', 'author', @$state->direction, @$state->order); ?>
			</th>
			<th><?= @helper('grid.sort', 'Genre', 'genre', @$state->direction, @$state->order); ?>
			</th>
			<th><?= @helper('grid.sort', 'Enabled', 'enabled', @$state->direction, @$state->order); ?>
			</th>
		</tr>
	</thead>
	<tbody>
	<? $i = 0; $m = 0; ?>
	<? foreach (@$books as $book) : ?>
		<tr class="<?php echo 'row'.$m; ?>">
			<td align="center"><?= $i + 1; ?></td>
			<td align="center"><?= @helper('grid.id', $i, $book->id); ?></td>
			<td><a href="<?=@route('view=book&layout=form&id='.$book->id)?>"> <?= $book->title; ?>
			</a></td>
			<td><?= $book->author; ?></td>
			<td><?= $book->genre; ?></td>
			<td><?= @helper('grid.enable', $book->enabled, $i)?></td>
		</tr>
		<? $i = $i + 1; $m = (1 - $m); ?>
		<? endforeach; ?>

		<? if (!count(@$books)) : ?>
		<tr>
			<td colspan="8" align="center"><?= @text('No items found'); ?></td>
		</tr>
		<? endif; ?>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="20">
				<?= @helper('admin::com.bib.helper.paginator.pagination', @$total, @$state->offset, @$state->limit) ?>
			</td>
		</tr>
	</tfoot>
</table>
<input type="hidden" name="boxchecked" value="0" /></form>
